﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="d" uri="/WEB-INF/resource.tld"%>

<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />
<!DOCTYPE html>
<html lang="zh-CN">
<head>

<%@ include file="/WEB-INF/include/meta.jsp"%>
<%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body>

	<%@ include file="/WEB-INF/include/header.jsp"%>

	<%@ include file="/WEB-INF/include/menu.jsp"%>

	<div class="container main-content">

		<div class="panel panel-default x-panel x-panel-layout">

			<div class="panel-heading">
				<ol class="breadcrumb">
					<li><a href="${ctx.host}/ecommerce">渠道管理</a></li>
					<li class="active">用户渠道数据详情</li>
				</ol>
			</div>

			<div class="panel-body">

				<div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
					<%@ include file="/WEB-INF/include/submenu.jsp"%>
				</div>

				<div class="col-xs-10 x-panel-layout-right">

					<div class="x-breadcrumb-wrapper">
						<div class="x-breadcrumb clearfix">
							<h2>
								<i class="glyphicon glyphicon-fire" title=""></i>&nbsp;&nbsp;<span>渠道管理&nbsp;-&nbsp;用户渠道数据</span>
							</h2>
						</div>

					</div>

					<div class="x-breadcrumb yellow clearfix">
						<h2>
							<span>基本信息</span>
						</h2>
					</div>

					<div class="form-horizontal x-form-horizontal clearfix">
						<div class="form-group">
							<label class="control-label col-xs-2 text-right">姓名：</label>
							<div class="col-xs-3">
								<p class="form-control-static">${userSource.name}</p>
							</div>
							<label class="control-label col-xs-2 text-right">手机：</label>
							<div class="col-xs-3">
								<p class="form-control-static">${userSource.mobile}</p>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-xs-2 text-right">性别：</label>
							<div class="col-xs-3">
								<p class="form-control-static">${userSource.gender}</p>
							</div>
							<label class="control-label col-xs-2 text-right">微信号：</label>
							<div class="col-xs-3">
								<p class="form-control-static">${userSource.wechatnumber}</p>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-xs-2 text-right">首次门店：</label>
							<div class="col-xs-3">
								<p class="form-control-static">${userSource.site.name}</p>
							</div>
							<label class="control-label col-xs-2 text-right">首次接待人：</label>
							<div class="col-xs-3">
								<c:choose>
									<c:when test="${not empty userSource.receiver}">
										<p class="form-control-static">${userSource.receiver.name}</p>
									</c:when>
									<c:otherwise>
										<p class="form-control-static">${userSource.receiverName}</p>
									</c:otherwise>
								</c:choose>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-xs-2 text-right">初始需求：</label>
							<div class="col-xs-3">
								<p class="form-control-static">${userSource.requirement}</p>
							</div>
							<label class="control-label col-xs-2 text-right">渠道：</label>
							<div class="col-xs-3">
								<c:choose>
									<c:when test="${not empty userSource.userSourceType}">
										<p class="form-control-static">${userSource.userSourceType.name}</p>
									</c:when>
									<c:otherwise>
										<p class="form-control-static">${userSource.userSourceTypeName}</p>
									</c:otherwise>
								</c:choose>
							</div>
						</div>

					</div>


					<div class="x-breadcrumb yellow clearfix">
						<h2>
							<span>回访记录</span>
						</h2>
					</div>
					<div class="x-breadcrumb-wrapper clearfix" style="position: relative; margin-top: 15px;">
            <div class="btn-group pull-left">
              <a href="${ctx.host}/user-source/${userSource.id}/create-record" class="btn btn-default x-btn btn-shadow btn-shadow-default"  data-target="#" data-toggle="modal"> <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;添加回访
              </a>
            </div>
          </div>
					<table class="table table-striped table-hover x-table" style="margin-bottom: 20px;">
						<thead>
							<tr>
								<th>接待时间</th>
								<th>接待方式</th>
								<th>接待人</th>
								<th>学员需求</th>
								<th>访问备注</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach var="userSourceRecord" items="${userSourceRecords}">
								<tr>
									<td>${userSourceRecord.createTime}</td>
									<td>${userSourceRecord.type}</td>
									<td>${userSourceRecord.receiver.name}</td>
									<td>${userSourceRecord.description}</td>
									<td>${userSourceRecord.remark}</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>

					<div class="x-breadcrumb yellow clearfix">
						<h2>
							<span>课程记录</span>
						</h2>
					</div>
					<!-- http://127.0.0.1:8089/fitstart-admin/experience-orders/create-experience -->
					<div class="x-breadcrumb-wrapper clearfix" style="position: relative; margin-top: 15px;">
						<div class="btn-group pull-left">
							<a href="${ctx.host}/schedules?coachview=false&site=" target="_BLANK" class="btn btn-default x-btn btn-shadow btn-shadow-default"> <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;单次体验课
							</a>
						</div>
						<div class="btn-group pull-right">
							<a href="${ctx.host}/experience-orders/create-experience?mobile=${userSource.mobile}&name=${userSource.name}" data-target="#" data-toggle="modal" class="btn btn-default x-btn btn-shadow btn-shadow-default"> <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;体验课包
							</a> <a href="${ctx.host}/orders-in/create-order-in?type=individual&mobile=${userSource.mobile}&name=${userSource.name}" data-target="#" data-toggle="modal" class="btn btn-default x-btn btn-shadow btn-shadow-default"> <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;常规课
							</a> <a href="${ctx.host}/orders-in/create-order-in?type=special&mobile=${userSource.mobile}&name=${userSource.name}" data-target="#" data-toggle="modal" class="btn btn-default x-btn btn-shadow btn-shadow-default"> <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;特色课
							</a> <a href="${ctx.host}/orders-in/create-order-in?type=posture&mobile=${userSource.mobile}&name=${userSource.name}" data-target="#" data-toggle="modal" class="btn btn-default x-btn btn-shadow btn-shadow-default"> <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;体态课
							</a> <a href="${ctx.host}/year-orders/create-year?mobile=${userSource.mobile}&name=${userSource.name}" data-target="#" data-toggle="modal" class="btn btn-default x-btn btn-shadow btn-shadow-default"> <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;周期课
							</a>
						</div>
					</div>
					<table class="table table-striped table-hover x-table" style="margin-bottom: 20px;">
						<thead>
							<tr>
								<th>课程大类</th>
								<th>课程二类</th>
								<th>金额</th>
								<th>课时</th>
								<!-- <th>课件属性</th> -->
								<th>教练&nbsp;/&nbsp;门店</th>
								<th>开启&nbsp;/&nbsp;冻结&nbsp;/&nbsp;过期</th>
								<th>已/可冻结次数</th>
								<th>状态</th>
                <th>操作</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach var="courseRound" items="${courseRounds}">
								<tr>
									<td>${courseRound.courseType.description }</td>
									<td>${courseRound.course.name }</td>
									<td><fmt:formatNumber value="${courseRound.order.price / 100}" pattern="0.00" maxFractionDigits="2" /></td>
									<c:choose>
										<c:when test="${status == 'prepare'}">
											<td><c:choose>
													<c:when test="${not empty courseRound.attrs['course_amount']}">
                            ${courseRound.attrs['course_amount'].value}
                          </c:when>
													<c:otherwise>
                            ${courseRound.course.hours}
                          </c:otherwise>
												</c:choose></td>
										</c:when>
										<c:otherwise>
											<td>${courseRound.finished}&nbsp;/&nbsp;<c:choose>
													<c:when test="${not empty courseRound.attrs['course_amount']}">
                            ${courseRound.attrs['course_amount'].value}
                          </c:when>
													<c:otherwise>
                            ${courseRound.course.hours}
                          </c:otherwise>
												</c:choose>
											</td>
										</c:otherwise>
									</c:choose>
									<%-- <td><p>${courseRound.fitnessGroup.name}</p>
                        <p><c:if test="${not empty courseRound.student.tagIds}"><c:forEach var="tag" items="${persist.coursewareTags(courseRound.student.arrayTagIds)}">${tag.name}&nbsp;&nbsp;</c:forEach></c:if></p>
                    </td> --%>
									<td>${courseRound.coach.name}&nbsp;/&nbsp;${courseRound.site.name}</td>
									<td><c:choose>
											<c:when test="${courseRound.effectiveStart == null}">
                        未开启<br />
											</c:when>
											<c:otherwise>
												<fmt:formatDate value="${courseRound.effectiveStart}" pattern="yyyy-MM-dd" />
												<br />
											</c:otherwise>
										</c:choose> <c:choose>
											<c:when test="${courseRound.holdDate != null}">
												<fmt:formatDate value="${courseRound.holdDate}" pattern="yyyy-MM-dd" />${empty courseRound.holdEndDate ? '<br/>' : ''}
                        <c:if test="${not empty courseRound.holdEndDate}">
                          &nbsp;&nbsp;-&nbsp;&nbsp;<fmt:formatDate value="${courseRound.holdEndDate}" pattern="yyyy-MM-dd" />
													<br />
												</c:if>
											</c:when>
											<c:otherwise>
                        未冻结<br />
											</c:otherwise>
										</c:choose> <fmt:formatDate value="${courseRound.effectiveEndTime}" pattern="yyyy-MM-dd" /></td>
									<td>${courseRound.freezedNumber}/${courseRound.course.freezingNumber}</td>
									<td>${courseRound.courseStatus.description}</td>
									<td><a href="${ctx.host}/${courseRound.course.courseType.alias}-rounds/${courseRound.id}">详情</a></td>
								</tr>
							</c:forEach>
						</tbody>
					</table>

					<jsp:include page="/WEB-INF/include/page.jsp">
						<jsp:param name="url" value="${pagetype}-rounds" />
						<jsp:param name="queryString" value="${queryString}" />
					</jsp:include>

				</div>
			</div>
		</div>
	</div>

	<%@ include file="/WEB-INF/include/script.jsp"%>
	<d:resource root="${ctx.resource}/build" type="script" src="js/page/usersource/usersource-list.js">
		<script type="text/javascript">
			require([ 'page/usersource/usersource-list' ], function(page) {
				page.init({})
			})
		</script>
	</d:resource>

</body>

</html>
